from sqlalchemy.ext.associationproxy import association_proxy


class Ip(object):
  """Represents an IP.
  """
  
  machines = association_proxy('machineassociations', 'machine',
                            creator=lambda m, **kw:MachineIp(machine=m, **kw))
  
  def __init__(self, address, available=True):
    """
    Arguments:
      - address (str): the ip address (eg: "172.17.17.78")
      - available (bool): optional, False if the is used staticaly (server...)
    """
    self.address = address
    self.available = available

  def __repr__(self):
    return self.address